package Lambda;

public class LambdaDemo3 {

    public static void main(String[] args) {
        Shop shop=new Shop();
   /*Runnable runnable=new Runnable() {
        @Override
        public void run() {
           shop.buy();
        }
    };*/
        //lambda表达式写法
        // Runnable runnable=()->shop.buy();
        //当lambda表达式中参数列表与表达式调用的方法参数类表一致时，可以简写为：方法引用
        Runnable runnable=shop::buy;
        new Thread(shop::buy).start();
        //通过类名调用静态方法
        new Thread(Shop::doSome).start();
    }
}
class Shop{
    public static void doSome(){
        System.out.println("买东西");
    }
    public void buy(){
        System.out.println("买东西...");
    }
}
